Skip to content

Add read-only package broker policy inspector - #5292

Draft
Benoît Cortier (CBenoit) wants to merge 4 commits into
mainfrom
cbenoit-plan-policy-inspector-ui
Draft

Add read-only package broker policy inspector#5292
Benoît Cortier (CBenoit) wants to merge 4 commits into
mainfrom
cbenoit-plan-policy-inspector-ui

Conversation

@CBenoit

@CBenoit Benoît Cortier (CBenoit) commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

  • add a Windows-only Administrator entry and dedicated read-only active package-broker policy inspector
  • consume BrokerClient.GetPolicy and shared PolicyDocument/PolicyJson without raw transport, duplicate DTOs, filesystem access, or mutation
  • present Agent reachability/compatibility states, server and policy metadata, enforcement, ordered rules, all matches/constraints, and canonical JSON with clipboard copy
  • keep inspection independent of UseAgentBroker, cancellable, stale-safe, localized, searchable, accessible, and NativeAOT-safe
  • centralize broker client construction so existing brokered package operations retain their transport/elevation behavior
  • validate required/defaulted policy data against shared schema constraints and classify malformed nested, unknown-property, numeric-enum, and noncanonical-enum payloads as InvalidResponse

Coordinated Phase 1 work

Exact local integration evidence

Validated against now-libraries PR #93 head 032a8f2376bf4ef32e94f04fe672651dd22227a3 using the rebuilt unpublished 0.4.0 package set documented by its authoritative MANIFEST.md and SHA256SUMS.txt. All six hashes were independently recomputed. Restore used command-line RestoreAdditionalProjectSources and a new empty package cache; the three restored nupkg hashes and .nupkg.metadata source entries confirm that Model, API, and Client came from this exact artifact set. No local feed path, NuGet configuration, or cache is committed.

Package SHA-256
Devolutions.Now.Policy.Model.0.4.0.nupkg 8c46aefc4cc8a3605cef25ca53690951eb34b7dccd1169d0504a145596394153
Devolutions.Now.Policy.Model.0.4.0.snupkg f01d27378e646b10735756933add0db18b1cb6963edc199d965b4c220f17dca9
Devolutions.Now.Policy.Api.0.4.0.nupkg 146985e2303a797d2bee13cf754ce3edf697d50a363166c5e01160d394bb211a
Devolutions.Now.Policy.Api.0.4.0.snupkg 5f6dee8b46963d97cb815db45a8ea68a023883febb465da060d66329499162a2
Devolutions.Now.Policy.Client.0.4.0.nupkg eac016c67bbaef480da2df2bc9679eb48ad62c12bbc7622314ead53ede3cf99f
Devolutions.Now.Policy.Client.0.4.0.snupkg c09235e5c3a8298cfbacad37ef5be615dae6be79e42acffe7bd6767f1f645c33

Focused compatibility validation against this exact set:

  • policy inspector: 82 passed on each PackageEngine target (net10.0 and net10.0-windows10.0.26100.0), 164 executions total
  • existing broker request/package/source operation regressions: 81 passed on each PackageEngine target, 162 executions total
  • inspector view-model/settings-search tests: 18 passed

The existing unchanged-code baseline remains 1,380 Windows solution tests passed and a successful win-x64 NativeAOT publish with no inspector-specific trim/AOT diagnostics. The full solution and NativeAOT publish were not rerun for this package rebuild because the C# binaries/contracts, dependency graph, and UniGetUI code are unchanged; the exact-artifact focused checks above passed.

Dependency/publication gate

This PR intentionally remains draft. Devolutions.Now.Policy.Model, .Api, and .Client 0.4.0 are not yet published to the configured public NuGet feed. Final readiness is blocked on publishing the exact packages produced from now-libraries#93 head 032a8f2376bf4ef32e94f04fe672651dd22227a3, updating the committed package references if the published identity changes, and rerunning restore/tests/NativeAOT from the public feed.

The non-Windows runtime matrix remains a runner gap; defensive platform guards and Windows-only settings-search filtering are covered by unit tests. Do not mark ready or merge until the coordinated dependency gate is cleared.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Windows-only, read-only Devolutions Agent package-policy inspector integrated into Administrator settings.

Changes:

  • Adds broker policy retrieval, validation, status mapping, and centralized client creation.
  • Adds searchable, localized UI for policy metadata, rules, constraints, and canonical JSON.
  • Adds coverage for broker responses, cancellation, stale refreshes, and search visibility.

The unpublished 0.4.0 dependencies remain a merge blocker.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/UniGetUI.Tests/UniGetUI.Tests.csproj Adds inspector test dependencies.
src/UniGetUI.Tests/SettingsSearchIndexTests.cs Tests platform-aware search.
src/UniGetUI.Tests/AgentPolicyInspectorViewModelTests.cs Tests presentation and refresh behavior.
src/UniGetUI.PackageEngine.Tests/BrokerPolicyInspectorTests.cs Tests policy transport and validation.
src/UniGetUI.PackageEngine.Operations/PackageOperations.cs Uses centralized broker creation.
src/UniGetUI.PackageEngine.AgentBroker/UniGetUI.PackageEngine.AgentBroker.csproj Updates policy dependencies.
src/UniGetUI.PackageEngine.AgentBroker/BrokerPolicyInspector.cs Implements policy inspection.
src/UniGetUI.PackageEngine.AgentBroker/BrokerClientFactory.cs Centralizes broker configuration.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/SettingsBasePage.axaml.cs Registers the inspector page.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/AgentPolicyInspector.axaml.cs Connects view model and clipboard.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/AgentPolicyInspector.axaml Defines the inspector UI.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/Administrator.axaml.cs Forwards inspector navigation.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/Administrator.axaml Adds the Windows-only entry.
src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/AgentPolicyInspectorViewModel.cs Formats policy data and manages refreshes.
src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/AdministratorViewModel.cs Adds navigation command.
src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj References the broker project.
src/UniGetUI.Avalonia/InternalsVisibleTo.cs Exposes internals to tests.
src/UniGetUI.Avalonia/Infrastructure/SettingsSearchIndex.cs Indexes the Windows-only inspector.
src/Languages/lang_en.json Adds inspector localization strings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Reject malformed required policy data using schema-aligned validation and cover missing, defaulted, nested, and wire-invalid responses.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the settings shell as the single page-level heading for assistive technologies.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match the repository formatter so the code-style CI check passes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants